package com.cet.lxf.reflection.test03;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-07-29 10:28
 **/
public class Main {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class cls = Class.forName("com.cet.lxf.reflection.test03.Student");
        System.out.println(cls.getMethod("getScore", String.class));
        System.out.println(cls.getDeclaredMethod("getGrade", int.class));
        System.out.println(cls.getMethod("getName"));
    }
}

class Student extends Person {
    public int getScore(String type) {
        return 99;
    }
    private int getGrade(int year) {
        return 1;
    }
}

class Person {
    public String getName() {
        return "Person";
    }
}
